package com.android.entities;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class HistoryEntry {

	private String id;
	private String name;
	private float rate;
	private int recommended;
	private int sent;
	private Date date;

	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public float getRate() {
		return rate;
	}
	
	public void setRate(float rate) {
		this.rate = rate;
	}
	
	public int getRecommended() {
		return recommended;
	}
	
	public void setRecommended(int recommended) {
		this.recommended = recommended;
	}
	
	public int getSent() {
		return sent;
	}
	
	public void setSent(int sent) {
		this.sent = sent;
	}
	
	public Date getDate() {
		return date;
	}
	
	public void setDate(Date date) {
		this.date = date; 
	}
	
	public void setDate(String date) {
		setDate(date, "dd/MM/yyyy");
	}
	
	public void setDate(String date, String pattern) {
		if (date == null || date.length() == 0)
			return;
					
		DateFormat fmt = new SimpleDateFormat(pattern);
		try {
			this.date = new Date(fmt.parse(date).getTime());
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

}
